<div class="row">
    <aside class="col-lg-3">

    </aside>

    <aside class="col-lg-9">
        <header class="b-b">
            <h4>Welcome to <b><?php echo $organisation['Organisation']['name']; ?></b> <?php echo $category['OrganisationMemberCategory']['name']; ?> Registration </h4>
            <p class="muted"><i>Complete the form below to register and join.</i></p>
        </header>

        <section class="p-sm">
            <form action="" class="form form-horizontal" method="post">
                <div class="form-group">
                    <div class="control-label col-lg-3">* Name: </div>
                    <div class="controls col-lg-9 form-inline">
                        <select name="title" class="form-control input-sm input-s-sm" required=""> 
                            <?php
                            $titles = array('' => '--', 'mr' => 'Mr.', 'mrs' => 'Mrs.', 'ms' => 'Ms.', 'dr' => 'Dr.', 'prof' => 'Prof.', 'prof_dr' => 'Prof. Dr.', 'rev' => 'Rev.', 'rev_dr' => 'Rev. Dr.');

                            foreach ($titles as $key => $value) {
                                $selected = isset($member) && $member['Member']['title'] == $key ? 'selected' : '';
                                echo "<option value='$key' $selected>$value</option>";
                            }
                            ?>
                        </select>
                        <input type="text" class="form-control input-sm input-s-sm" name="first_name" placeholder="First Name" required="" />
                        <input type="text" class="form-control input-sm input-s-sm" name="last_name" placeholder="Last Name" required="" />
                    </div>
                </div>
                
                <div class="form-group">
                    <div class="control-label col-lg-3">* Date Of Birth: </div>
                    <div class="controls col-lg-9 form-inline">
                        <input type="text" name="dob" id="birthday" class="form-control input-sm input-s-sm datepicker-input" data-date-format="yyyy-mm-dd" value="<?php echo isset($member) ? $member['Member']['dob'] : ''; ?>" required="" />
                    </div>
                </div>
                
                <div class="form-group">
                    <div class="control-label col-lg-3">Gender: </div>
                    <div class="controls col-lg-9 form-inline">
                        <select name="gender" class="form-control input-sm input-s-sm" required="">
                            <?php
                            $titles = array('' => 'Select', 'male' => 'Male', 'female' => 'Female');

                            foreach ($titles as $key => $value) {
                                $selected = isset($member) && $member['Member']['gender'] == $key ? 'selected' : '';
                                echo "<option value='$key' $selected>$value</option>";
                            }
                            ?>
                        </select>
                    </div>
                </div>
                
                <div class="form-group">
                    <div class="control-label col-lg-3">Marital Status: </div>
                    <div class="controls col-lg-9 form-inline">
                        
                        <select name="marital_status" class="form-control input-sm input-s-sm">
                            <?php
                            $titles = array('' => 'Select', 'single' => 'Single', 'married' => 'Married',
                                'separated' => 'Separated', 'divorced' => 'Divorced', 'cohabiting' => 'Cohabiting', 'widowed' => 'Widowed');

                            foreach ($titles as $key => $value) {
                                $selected = isset($member) && $member['Member']['marital_status'] == $key ? 'selected' : '';
                                echo "<option value='$key' $selected>$value</option>";
                            }
                            ?>
                        </select>
                    </div>
                </div>
                
                <div class="form-group">
                    <div class="control-label col-lg-3">Mobile Number: </div>
                    <div class="controls col-lg-9 form-inline">
                        
                        <input type="text" name="mobile_number" id="number" placeholder="Mobile No." class="form-control input-sm input-s phone_number" value="<?php echo isset($member) ? $member['Member']['mobile_number'] : ''; ?>"/>
                        
                        
                        <!--<div class="m-b-sm">
                            <input type="text" name="office_number" id="number" placeholder="Work" class="form-control input-sm input-s phone_number" value="<?php echo isset($member) ? $member['Member']['office_number'] : ''; ?>" />
                        </div>-->
                    </div>
                </div>
                
                <div class="form-group">
                    <div class="control-label col-lg-3">* Email: </div>
                    <div class="controls col-lg-9 form-inline">
                        <input type="text" class="form-control input-s input-sm" name="email" placeholder="Email Address" required="" />
                    </div>
                </div>
                
                <div class="form-group">
                    <div class="control-label col-lg-3">Postal Address: </div>
                    <div class="controls col-lg-9 form-inline">
                        <input type="text" name="postal_address" id="post_add" class="form-control input-sm input-s-lg" value="<?php echo isset($member) ? $member['Member']['address'] : ''; ?>" />
                    </div>
                </div>
                
                <div class="form-group form-actions">
                    <div class="control-label col-lg-3"></div>
                    <div class="controls col-lg-9 form-inline">
                        <button type="submit" class="btn btn-sm btn-success"><i class="fa fa-forward"></i> Register</button>
                        <a id="cancel-btn" href="<?php echo $this->Html->url('/'); ?>" class="btn btn-sm btn-danger">Cancel</a>
                    </div>
                </div>
                
            </form>
        </section>
    </aside>
</div>

<script type="text/javascript">

$(document).ready(function() {
    $("#cancel-btn").click(function(e) {
        if( confirm("You are canceling the registration process. Do you want to continue?") ) {
            return true;
        }
        
        e.preventDefault();
    });
    
    $(".phone_number").intlTelInput({
        defaultCountry: 'gh'
    });
});
</script>